package com.onpositive.inferencer.test;

import java.util.ArrayList;
import java.util.Arrays;

public class LinkSplitter {

	
	public static ArrayList<String> getLinks(String value){
		String[] split = value.split( "\\*#\\*");
		ArrayList<String>result=new ArrayList<String>();
		boolean found=false;
		for (String s:split){
			if (s.startsWith("[[")){
				found=true;
				int indexOf = s.indexOf("|");
				if (indexOf!=-1){
					result.add(s.substring(indexOf+1,s.length()-2).trim());
				}
			}
		}
		if (!found){
			if (value.trim().length()>0){
				result.addAll(Arrays.asList(split));
			}
		}
		return result;
	}
}
